<?php include('_init_.php'); ?>
<?php 
$GLOBALS['PAGE_ADDED_URL'] = 'products-add.php';
if ( isset($_REQUEST['cat_id']) ) {
	$GLOBALS['PAGE_ADDED_URL'] .= '?cat_id='.$_REQUEST['cat_id'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/admin-body.css" rel="stylesheet" type="text/css" />
<link href="../css/admin-products.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<title>班尼頓寫真後台管理</title>
</head>

<body>
<?php include_once('admin-top.php');?>
<div id="main" class="clearfix"><!-- star #main //-->
  <?php include_once('sub-products.php');?>
  <div id="contactall"><!-- star #main //-->
  <div id="tit" ><!-- star #tit //-->
    <ul>
    <li class="tit-a">發燒商品</li>
    <li class="tit-b"><a href="<?php echo $GLOBALS['PAGE_ADDED_URL'];?>">新增商品</a></li>
    </ul>
  </div><!-- end #tit //-->
  <div id="contact" class="clearfix" ><!-- star #contact //-->
  <ul>
  <li class="peo-a">分類</li>
  <li class="peo-b">標題</li>
  <li class="peo-c">金額</li>
  <li class="peo-e">功能</li>
  </ul>
   <?php foreach($GLOBALS['PAGE_LIST_DATA'] as $row):?>
    <ul>
 
  <li class="peo-a"><?php echo $GLOBALS['GV_PRODUCT_CAT'][$row['cat_id']];?></li>  
  <li class="peo-b"><?php echo $row['name'];?></li>
   <li class="peo-c"><?php echo $row['price'];?></li>
  <li class="peo-e">
  <a href="products-add.php?act=edit&id=<?php echo $row['id'];?>">修改</a>
  <a href="<?php echo $_SERVER['PHP_SELF']?>?act=set_delete&id=<?php echo $row['id'];?>">暫停</a>
  <a href="<?php echo $_SERVER['PHP_SELF']?>?act=delete&id=<?php echo $row['id'];?>" onclick="return confirm('確定刪除?');">刪除</a>
  </li>
  </ul>
   <?php endforeach;?>
  <ul>
  
  
  </div><!-- end #contact //-->
  <div id="page">
  <ul>
     <?php if ( $GLOBALS['PAGE_LIST_PAGE'] < $GLOBALS['PAGE_LIST_TOTAL_PAGE']):?>
    <li><a href="#" onclick="return next_page();">以前の &gt;</a> </li>
     <?php endif;?>
     
    <?php if ( $GLOBALS['PAGE_LIST_PAGE'] > 1):?>
    <li> <a href="#" onclick="return prev_page();"> &lt;次の </a> </li>
     <?php endif;?>
  </ul>
</div>
  </div><!-- end #contactall //-->
</div><!-- end #main //-->
<script type="text/javascript">
function next_page()
{
	var form = document.forms['form_filter'];
	form.page.value = parseInt(form.page.value,10) + 1;
	form.submit();
	return false;
}
function prev_page()
{
	var form = document.forms['form_filter'];
	form.page.value =  parseInt(form.page.value,10) - 1;
	form.submit();
	return false;
}
function set_filter_key_word(key_word)
{
	var form = document.forms['form_filter'];
	form.key_word.value =  key_word;
	form.submit();
	return false;
}
</script>
<form method="get" name="form_filter" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'];?>"/>
<input type="hidden" name="key_word" value="<?php echo isset($_REQUEST['key_word'])?$_REQUEST['key_word']:'';?>"/>
<input type="hidden" name="cat_id" value="<?php echo isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] > 0?$_REQUEST['cat_id']:'';?>"/>
</form>
</body>
</html>